<?php


//get address by id	
function getAddressByID($addressID){
	$qr ="SELECT * FROM address WHERE AddressID = $addressID;";
	return mysql_query($qr);
}

//add address and return id of last record
function addAddress($houseNumber, $street, $ward, $district, $city){
	$qr ="INSERT INTO address(HouseNumber,Street,Ward,District,City) VALUES('$houseNumber','$street','$ward','$district','$city')";
	mysql_query($qr);
	return mysql_insert_id();
}

//edit address 
function editAddress($houseNumber, $street, $ward, $district, $city, $addressID){
	$qr ="UPDATE address SET HouseNumber = '$houseNumber',Street = '$street', Ward = '$ward',District = '$district', City = '$city' WHERE AddressID = $addressID; ";
	mysql_query($qr);
	return mysql_insert_id();
}

?>